package com.szgz.platform.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 共享IDE环境模型
 */
@TableName("shared_ide_environment")
public class SharedIDEEnvironment {
    
    @TableId(type = IdType.ASSIGN_UUID)
    private String environmentId;
    
    /**
     * 组ID（如班级ID）
     */
    private String groupId;
    
    /**
     * 组名称（如班级名称）
     */
    private String groupName;
    
    /**
     * 学生ID列表，JSON格式
     */
    private String studentIds;
    
    /**
     * 学生到端口的映射，JSON格式
     */
    private String portMapping;
    
    /**
     * 学生到URL的映射，JSON格式
     */
    private String urlMapping;
    
    /**
     * 容器名称
     */
    private String containerName;
    
    /**
     * 状态：RUNNING, STOPPED, ERROR
     */
    private String status;
    
    /**
     * 创建者ID
     */
    private String createdBy;
    
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;
    
    /**
     * 最后启动时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastStarted;
    
    /**
     * 是否删除
     */
    private Boolean deleted;
    
    // 构造函数
    public SharedIDEEnvironment() {}
    
    public SharedIDEEnvironment(String groupId, String groupName, String createdBy) {
        this.groupId = groupId;
        this.groupName = groupName;
        this.createdBy = createdBy;
        this.status = "CREATED";
        this.createdAt = LocalDateTime.now();
        this.deleted = false;
    }
    
    // Getter和Setter方法
    public String getEnvironmentId() {
        return environmentId;
    }
    
    public void setEnvironmentId(String environmentId) {
        this.environmentId = environmentId;
    }
    
    public String getGroupId() {
        return groupId;
    }
    
    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }
    
    public String getGroupName() {
        return groupName;
    }
    
    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }
    
    public String getStudentIds() {
        return studentIds;
    }
    
    public void setStudentIds(String studentIds) {
        this.studentIds = studentIds;
    }
    
    public String getPortMapping() {
        return portMapping;
    }
    
    public void setPortMapping(String portMapping) {
        this.portMapping = portMapping;
    }
    
    public String getUrlMapping() {
        return urlMapping;
    }
    
    public void setUrlMapping(String urlMapping) {
        this.urlMapping = urlMapping;
    }
    
    public String getContainerName() {
        return containerName;
    }
    
    public void setContainerName(String containerName) {
        this.containerName = containerName;
    }
    
    public String getStatus() {
        return status;
    }
    
    public void setStatus(String status) {
        this.status = status;
    }
    
    public String getCreatedBy() {
        return createdBy;
    }
    
    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }
    
    public LocalDateTime getCreatedAt() {
        return createdAt;
    }
    
    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }
    
    public LocalDateTime getLastStarted() {
        return lastStarted;
    }
    
    public void setLastStarted(LocalDateTime lastStarted) {
        this.lastStarted = lastStarted;
    }
    
    public Boolean getDeleted() {
        return deleted;
    }
    
    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }
    
    @Override
    public String toString() {
        return "SharedIDEEnvironment{" +
                "environmentId='" + environmentId + '\'' +
                ", groupId='" + groupId + '\'' +
                ", groupName='" + groupName + '\'' +
                ", studentIds='" + studentIds + '\'' +
                ", portMapping='" + portMapping + '\'' +
                ", urlMapping='" + urlMapping + '\'' +
                ", containerName='" + containerName + '\'' +
                ", status='" + status + '\'' +
                ", createdBy='" + createdBy + '\'' +
                ", createdAt=" + createdAt +
                ", lastStarted=" + lastStarted +
                ", deleted=" + deleted +
                '}';
    }
} 